/*
'===============================================================================
'  Generated From - CSharp_EasyObject_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL      = SQL_DAAB_StoredProcs.vbgen
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easily done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.Common;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Xml;
using System.IO;

using Microsoft.Practices.EnterpriseLibrary.Data;
using NCI.EasyObjects;

namespace CMS.DAL
{

	#region Schema

	public class VideoSchema : NCI.EasyObjects.Schema
	{
		private static ArrayList _entries;
		public static SchemaItem VideoID = new SchemaItem("VideoID", DbType.Int32, true, false, false, true, false, false);
		public static SchemaItem VideoTitle1 = new SchemaItem("VideoTitle1", DbType.String, SchemaItemJustify.None, 255, true, false, false, false);
		public static SchemaItem VideoTitle2 = new SchemaItem("VideoTitle2", DbType.String, SchemaItemJustify.None, 255, true, false, false, false);
		public static SchemaItem VideoTitle3 = new SchemaItem("VideoTitle3", DbType.String, SchemaItemJustify.None, 255, true, false, false, false);
		public static SchemaItem URL = new SchemaItem("URL", DbType.String, SchemaItemJustify.None, 1073741823, true, false, false, false);
		public static SchemaItem InitContent1 = new SchemaItem("InitContent1", DbType.String, SchemaItemJustify.None, 2000, true, false, false, false);
		public static SchemaItem InitContent2 = new SchemaItem("InitContent2", DbType.String, SchemaItemJustify.None, 2000, true, false, false, false);
		public static SchemaItem InitContent3 = new SchemaItem("InitContent3", DbType.String, SchemaItemJustify.None, 2000, true, false, false, false);
		public static SchemaItem CreatedDate = new SchemaItem("CreatedDate", DbType.Int32, false, false, false, false, false, false);
		public static SchemaItem Status = new SchemaItem("Status", DbType.Int32, false, false, false, false, false, false);
		public static SchemaItem Priority = new SchemaItem("Priority", DbType.Int32, false, false, false, false, false, false);
		public static SchemaItem TourID = new SchemaItem("TourID", DbType.Int32, false, true, false, false, false, false);

		public override ArrayList SchemaEntries
		{
			get
			{
				if (_entries == null )
				{
					_entries = new ArrayList();
					_entries.Add(VideoSchema.VideoID);
					_entries.Add(VideoSchema.VideoTitle1);
					_entries.Add(VideoSchema.VideoTitle2);
					_entries.Add(VideoSchema.VideoTitle3);
					_entries.Add(VideoSchema.URL);
					_entries.Add(VideoSchema.InitContent1);
					_entries.Add(VideoSchema.InitContent2);
					_entries.Add(VideoSchema.InitContent3);
					_entries.Add(VideoSchema.CreatedDate);
					_entries.Add(VideoSchema.Status);
					_entries.Add(VideoSchema.Priority);
					_entries.Add(VideoSchema.TourID);
				}
				return _entries;
			}
		}
		
		public static bool HasAutoKey 
		{
			get { return true;	}
		}

		public static bool HasRowID 
		{
			get { return false;	}
		}
	}
	#endregion

	public abstract class _Video : EasyObject
	{

		public _Video()
		{
			VideoSchema _schema = new VideoSchema();
			this.SchemaEntries = _schema.SchemaEntries;
			this.SchemaGlobal = "dbo";
		}
		
		public override void FlushData() 	 
		{ 	 
			this._whereClause = null; 	 
			this._aggregateClause = null; 	 
			base.FlushData(); 	 
		}
			   
		/// <summary>
		/// Loads the business object with info from the database, based on the requested primary key.
		/// </summary>
		/// <param name="VideoID"></param>
		/// <returns>A Boolean indicating success or failure of the query</returns>
		public bool LoadByPrimaryKey(int VideoID)
		{
			switch(this.DefaultCommandType)
			{
				case CommandType.StoredProcedure:
					ListDictionary parameters = new ListDictionary();

					// Add in parameters
					parameters.Add(VideoSchema.VideoID.FieldName, VideoID);

					return base.LoadFromSql(this.SchemaStoredProcedureWithSeparator + "sp_GetVideo", parameters, CommandType.StoredProcedure);

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					this.Where.VideoID.Value = VideoID;
					return this.Query.Load();

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}
	
		/// <summary>
		/// Loads all records from the table.
		/// </summary>
		/// <returns>A Boolean indicating success or failure of the query</returns>
		public bool LoadAll()
		{
			switch(this.DefaultCommandType)
			{
				case CommandType.StoredProcedure:
					return base.LoadFromSql(this.SchemaStoredProcedureWithSeparator + "sp_GetAllVideo", null, CommandType.StoredProcedure);

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					return this.Query.Load();

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		/// <summary>
		/// Adds a new record to the internal table.
		/// </summary>
		public override void AddNew()
		{
			base.AddNew();
			this.ApplyDefaults();
		}

		/// <summary>
		/// Apply any default values to columns
		/// </summary>
		protected override void ApplyDefaults()
		{
		}

		protected override DbCommand GetInsertCommand(CommandType commandType)
		{	
			DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_AddVideo";
					dbCommand = db.GetStoredProcCommand(sqlCommand);

					db.AddParameter(dbCommand, "VideoID", DbType.Int32, 0, ParameterDirection.Output, true, 0, 0, "VideoID", DataRowVersion.Default, Convert.DBNull);
					CreateParameters(db, dbCommand);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					foreach(SchemaItem item in this.SchemaEntries)
					{
						if (!item.IsComputed)
						{
							if ((item.IsAutoKey && this.IdentityInsert) || !item.IsAutoKey)
							{
								this.Query.AddInsertColumn(item);
							}
						}
					}
					dbCommand = this.Query.GetInsertCommandWrapper();

					dbCommand.Parameters.Clear();
					if (this.IdentityInsert)
					{
						db.AddInParameter(dbCommand, "VideoID", DbType.Int32, "VideoID", DataRowVersion.Default);
					}
					else
					{
						db.AddParameter(dbCommand, "VideoID", DbType.Int32, 0, ParameterDirection.Output, true, 0, 0, "VideoID", DataRowVersion.Default, Convert.DBNull);
					}
					CreateParameters(db, dbCommand);

					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		protected override DbCommand GetUpdateCommand(CommandType commandType)
		{
            DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_UpdateVideo";
					dbCommand = db.GetStoredProcCommand(sqlCommand);

					db.AddInParameter(dbCommand, "VideoID", DbType.Int32, "VideoID", DataRowVersion.Current);
					CreateParameters(db, dbCommand);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					foreach(SchemaItem item in this.SchemaEntries)
					{
						if (!(item.IsAutoKey || item.IsComputed))
						{
							this.Query.AddUpdateColumn(item);
						}
					}

					this.Where.WhereClauseReset();
					this.Where.VideoID.Operator = WhereParameter.Operand.Equal;
					dbCommand = this.Query.GetUpdateCommandWrapper();

					dbCommand.Parameters.Clear();
					CreateParameters(db, dbCommand);
					db.AddInParameter(dbCommand, "VideoID", DbType.Int32, "VideoID", DataRowVersion.Current);
					
					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		protected override DbCommand GetDeleteCommand(CommandType commandType)
		{
            DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_DeleteVideo";
					dbCommand = db.GetStoredProcCommand(sqlCommand);
					db.AddInParameter(dbCommand, "VideoID", DbType.Int32, "VideoID", DataRowVersion.Current);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					this.Where.VideoID.Operator = WhereParameter.Operand.Equal;
					dbCommand = this.Query.GetDeleteCommandWrapper();

					dbCommand.Parameters.Clear();
					db.AddInParameter(dbCommand, "VideoID", DbType.Int32, "VideoID", DataRowVersion.Current);
					
					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		private void CreateParameters(Database db, DbCommand dbCommand)
		{
			db.AddInParameter(dbCommand, "VideoTitle1", DbType.String, "VideoTitle1", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "VideoTitle2", DbType.String, "VideoTitle2", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "VideoTitle3", DbType.String, "VideoTitle3", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "URL", DbType.String, "URL", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "InitContent1", DbType.String, "InitContent1", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "InitContent2", DbType.String, "InitContent2", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "InitContent3", DbType.String, "InitContent3", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "CreatedDate", DbType.Int32, "CreatedDate", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "Status", DbType.Int32, "Status", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "Priority", DbType.Int32, "Priority", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "TourID", DbType.Int32, "TourID", DataRowVersion.Current);
		}
		
		#region Properties
		public virtual int VideoID
		{
			get
			{
				return this.GetInteger(VideoSchema.VideoID.FieldName);
	    	}
			set
			{
				this.SetInteger(VideoSchema.VideoID.FieldName, value);
			}
		}
		public virtual string VideoTitle1
		{
			get
			{
				return this.GetString(VideoSchema.VideoTitle1.FieldName);
	    	}
			set
			{
				this.SetString(VideoSchema.VideoTitle1.FieldName, value);
			}
		}
		public virtual string VideoTitle2
		{
			get
			{
				return this.GetString(VideoSchema.VideoTitle2.FieldName);
	    	}
			set
			{
				this.SetString(VideoSchema.VideoTitle2.FieldName, value);
			}
		}
		public virtual string VideoTitle3
		{
			get
			{
				return this.GetString(VideoSchema.VideoTitle3.FieldName);
	    	}
			set
			{
				this.SetString(VideoSchema.VideoTitle3.FieldName, value);
			}
		}
		public virtual string URL
		{
			get
			{
				return this.GetString(VideoSchema.URL.FieldName);
	    	}
			set
			{
				this.SetString(VideoSchema.URL.FieldName, value);
			}
		}
		public virtual string InitContent1
		{
			get
			{
				return this.GetString(VideoSchema.InitContent1.FieldName);
	    	}
			set
			{
				this.SetString(VideoSchema.InitContent1.FieldName, value);
			}
		}
		public virtual string InitContent2
		{
			get
			{
				return this.GetString(VideoSchema.InitContent2.FieldName);
	    	}
			set
			{
				this.SetString(VideoSchema.InitContent2.FieldName, value);
			}
		}
		public virtual string InitContent3
		{
			get
			{
				return this.GetString(VideoSchema.InitContent3.FieldName);
	    	}
			set
			{
				this.SetString(VideoSchema.InitContent3.FieldName, value);
			}
		}
		public virtual int CreatedDate
		{
			get
			{
				return this.GetInteger(VideoSchema.CreatedDate.FieldName);
	    	}
			set
			{
				this.SetInteger(VideoSchema.CreatedDate.FieldName, value);
			}
		}
		public virtual int Status
		{
			get
			{
				return this.GetInteger(VideoSchema.Status.FieldName);
	    	}
			set
			{
				this.SetInteger(VideoSchema.Status.FieldName, value);
			}
		}
		public virtual int Priority
		{
			get
			{
				return this.GetInteger(VideoSchema.Priority.FieldName);
	    	}
			set
			{
				this.SetInteger(VideoSchema.Priority.FieldName, value);
			}
		}
		public virtual int TourID
		{
			get
			{
				return this.GetInteger(VideoSchema.TourID.FieldName);
	    	}
			set
			{
				this.SetInteger(VideoSchema.TourID.FieldName, value);
			}
		}

		public override string TableName
		{
			get { return "Video"; }
		}
		
		#endregion		
		
		#region String Properties
		public virtual string s_VideoID
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.VideoID.FieldName) ? string.Empty : base.GetIntegerAsString(VideoSchema.VideoID.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.VideoID.FieldName);
			    else
			        this.VideoID = base.SetIntegerAsString(VideoSchema.VideoID.FieldName, value);
			}
		}
		public virtual string s_VideoTitle1
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.VideoTitle1.FieldName) ? string.Empty : base.GetStringAsString(VideoSchema.VideoTitle1.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.VideoTitle1.FieldName);
			    else
			        this.VideoTitle1 = base.SetStringAsString(VideoSchema.VideoTitle1.FieldName, value);
			}
		}
		public virtual string s_VideoTitle2
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.VideoTitle2.FieldName) ? string.Empty : base.GetStringAsString(VideoSchema.VideoTitle2.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.VideoTitle2.FieldName);
			    else
			        this.VideoTitle2 = base.SetStringAsString(VideoSchema.VideoTitle2.FieldName, value);
			}
		}
		public virtual string s_VideoTitle3
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.VideoTitle3.FieldName) ? string.Empty : base.GetStringAsString(VideoSchema.VideoTitle3.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.VideoTitle3.FieldName);
			    else
			        this.VideoTitle3 = base.SetStringAsString(VideoSchema.VideoTitle3.FieldName, value);
			}
		}
		public virtual string s_URL
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.URL.FieldName) ? string.Empty : base.GetStringAsString(VideoSchema.URL.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.URL.FieldName);
			    else
			        this.URL = base.SetStringAsString(VideoSchema.URL.FieldName, value);
			}
		}
		public virtual string s_InitContent1
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.InitContent1.FieldName) ? string.Empty : base.GetStringAsString(VideoSchema.InitContent1.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.InitContent1.FieldName);
			    else
			        this.InitContent1 = base.SetStringAsString(VideoSchema.InitContent1.FieldName, value);
			}
		}
		public virtual string s_InitContent2
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.InitContent2.FieldName) ? string.Empty : base.GetStringAsString(VideoSchema.InitContent2.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.InitContent2.FieldName);
			    else
			        this.InitContent2 = base.SetStringAsString(VideoSchema.InitContent2.FieldName, value);
			}
		}
		public virtual string s_InitContent3
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.InitContent3.FieldName) ? string.Empty : base.GetStringAsString(VideoSchema.InitContent3.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.InitContent3.FieldName);
			    else
			        this.InitContent3 = base.SetStringAsString(VideoSchema.InitContent3.FieldName, value);
			}
		}
		public virtual string s_CreatedDate
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.CreatedDate.FieldName) ? string.Empty : base.GetIntegerAsString(VideoSchema.CreatedDate.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.CreatedDate.FieldName);
			    else
			        this.CreatedDate = base.SetIntegerAsString(VideoSchema.CreatedDate.FieldName, value);
			}
		}
		public virtual string s_Status
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.Status.FieldName) ? string.Empty : base.GetIntegerAsString(VideoSchema.Status.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.Status.FieldName);
			    else
			        this.Status = base.SetIntegerAsString(VideoSchema.Status.FieldName, value);
			}
		}
		public virtual string s_Priority
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.Priority.FieldName) ? string.Empty : base.GetIntegerAsString(VideoSchema.Priority.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.Priority.FieldName);
			    else
			        this.Priority = base.SetIntegerAsString(VideoSchema.Priority.FieldName, value);
			}
		}
		public virtual string s_TourID
		{
			get
			{
			    return this.IsColumnNull(VideoSchema.TourID.FieldName) ? string.Empty : base.GetIntegerAsString(VideoSchema.TourID.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(VideoSchema.TourID.FieldName);
			    else
			        this.TourID = base.SetIntegerAsString(VideoSchema.TourID.FieldName, value);
			}
		}
		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(EasyObject entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter VideoID
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.VideoID);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter VideoTitle1
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.VideoTitle1);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter VideoTitle2
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.VideoTitle2);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter VideoTitle3
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.VideoTitle3);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter URL
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.URL);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter InitContent1
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.InitContent1);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter InitContent2
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.InitContent2);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter InitContent3
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.InitContent3);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter CreatedDate
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.CreatedDate);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter Status
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.Status);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter Priority
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.Priority);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter TourID
				{
					get
					{
							WhereParameter wp = new WhereParameter(VideoSchema.TourID);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter VideoID
		    {
				get
		        {
					if(_VideoID_W == null)
	        	    {
						_VideoID_W = TearOff.VideoID;
					}
					return _VideoID_W;
				}
			}

			public WhereParameter VideoTitle1
		    {
				get
		        {
					if(_VideoTitle1_W == null)
	        	    {
						_VideoTitle1_W = TearOff.VideoTitle1;
					}
					return _VideoTitle1_W;
				}
			}

			public WhereParameter VideoTitle2
		    {
				get
		        {
					if(_VideoTitle2_W == null)
	        	    {
						_VideoTitle2_W = TearOff.VideoTitle2;
					}
					return _VideoTitle2_W;
				}
			}

			public WhereParameter VideoTitle3
		    {
				get
		        {
					if(_VideoTitle3_W == null)
	        	    {
						_VideoTitle3_W = TearOff.VideoTitle3;
					}
					return _VideoTitle3_W;
				}
			}

			public WhereParameter URL
		    {
				get
		        {
					if(_URL_W == null)
	        	    {
						_URL_W = TearOff.URL;
					}
					return _URL_W;
				}
			}

			public WhereParameter InitContent1
		    {
				get
		        {
					if(_InitContent1_W == null)
	        	    {
						_InitContent1_W = TearOff.InitContent1;
					}
					return _InitContent1_W;
				}
			}

			public WhereParameter InitContent2
		    {
				get
		        {
					if(_InitContent2_W == null)
	        	    {
						_InitContent2_W = TearOff.InitContent2;
					}
					return _InitContent2_W;
				}
			}

			public WhereParameter InitContent3
		    {
				get
		        {
					if(_InitContent3_W == null)
	        	    {
						_InitContent3_W = TearOff.InitContent3;
					}
					return _InitContent3_W;
				}
			}

			public WhereParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public WhereParameter Status
		    {
				get
		        {
					if(_Status_W == null)
	        	    {
						_Status_W = TearOff.Status;
					}
					return _Status_W;
				}
			}

			public WhereParameter Priority
		    {
				get
		        {
					if(_Priority_W == null)
	        	    {
						_Priority_W = TearOff.Priority;
					}
					return _Priority_W;
				}
			}

			public WhereParameter TourID
		    {
				get
		        {
					if(_TourID_W == null)
	        	    {
						_TourID_W = TearOff.TourID;
					}
					return _TourID_W;
				}
			}

			private WhereParameter _VideoID_W = null;
			private WhereParameter _VideoTitle1_W = null;
			private WhereParameter _VideoTitle2_W = null;
			private WhereParameter _VideoTitle3_W = null;
			private WhereParameter _URL_W = null;
			private WhereParameter _InitContent1_W = null;
			private WhereParameter _InitContent2_W = null;
			private WhereParameter _InitContent3_W = null;
			private WhereParameter _CreatedDate_W = null;
			private WhereParameter _Status_W = null;
			private WhereParameter _Priority_W = null;
			private WhereParameter _TourID_W = null;

			public void WhereClauseReset()
			{
				_VideoID_W = null;
				_VideoTitle1_W = null;
				_VideoTitle2_W = null;
				_VideoTitle3_W = null;
				_URL_W = null;
				_InitContent1_W = null;
				_InitContent2_W = null;
				_InitContent3_W = null;
				_CreatedDate_W = null;
				_Status_W = null;
				_Priority_W = null;
				_TourID_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private EasyObject _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
		
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(EasyObject entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter VideoID
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.VideoID);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter VideoTitle1
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.VideoTitle1);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter VideoTitle2
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.VideoTitle2);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter VideoTitle3
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.VideoTitle3);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter URL
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.URL);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter InitContent1
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.InitContent1);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter InitContent2
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.InitContent2);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter InitContent3
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.InitContent3);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter CreatedDate
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.CreatedDate);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter Status
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.Status);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter Priority
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.Priority);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter TourID
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(VideoSchema.TourID);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter VideoID
		    {
				get
		        {
					if(_VideoID_W == null)
	        	    {
						_VideoID_W = TearOff.VideoID;
					}
					return _VideoID_W;
				}
			}

			public AggregateParameter VideoTitle1
		    {
				get
		        {
					if(_VideoTitle1_W == null)
	        	    {
						_VideoTitle1_W = TearOff.VideoTitle1;
					}
					return _VideoTitle1_W;
				}
			}

			public AggregateParameter VideoTitle2
		    {
				get
		        {
					if(_VideoTitle2_W == null)
	        	    {
						_VideoTitle2_W = TearOff.VideoTitle2;
					}
					return _VideoTitle2_W;
				}
			}

			public AggregateParameter VideoTitle3
		    {
				get
		        {
					if(_VideoTitle3_W == null)
	        	    {
						_VideoTitle3_W = TearOff.VideoTitle3;
					}
					return _VideoTitle3_W;
				}
			}

			public AggregateParameter URL
		    {
				get
		        {
					if(_URL_W == null)
	        	    {
						_URL_W = TearOff.URL;
					}
					return _URL_W;
				}
			}

			public AggregateParameter InitContent1
		    {
				get
		        {
					if(_InitContent1_W == null)
	        	    {
						_InitContent1_W = TearOff.InitContent1;
					}
					return _InitContent1_W;
				}
			}

			public AggregateParameter InitContent2
		    {
				get
		        {
					if(_InitContent2_W == null)
	        	    {
						_InitContent2_W = TearOff.InitContent2;
					}
					return _InitContent2_W;
				}
			}

			public AggregateParameter InitContent3
		    {
				get
		        {
					if(_InitContent3_W == null)
	        	    {
						_InitContent3_W = TearOff.InitContent3;
					}
					return _InitContent3_W;
				}
			}

			public AggregateParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public AggregateParameter Status
		    {
				get
		        {
					if(_Status_W == null)
	        	    {
						_Status_W = TearOff.Status;
					}
					return _Status_W;
				}
			}

			public AggregateParameter Priority
		    {
				get
		        {
					if(_Priority_W == null)
	        	    {
						_Priority_W = TearOff.Priority;
					}
					return _Priority_W;
				}
			}

			public AggregateParameter TourID
		    {
				get
		        {
					if(_TourID_W == null)
	        	    {
						_TourID_W = TearOff.TourID;
					}
					return _TourID_W;
				}
			}

			private AggregateParameter _VideoID_W = null;
			private AggregateParameter _VideoTitle1_W = null;
			private AggregateParameter _VideoTitle2_W = null;
			private AggregateParameter _VideoTitle3_W = null;
			private AggregateParameter _URL_W = null;
			private AggregateParameter _InitContent1_W = null;
			private AggregateParameter _InitContent2_W = null;
			private AggregateParameter _InitContent3_W = null;
			private AggregateParameter _CreatedDate_W = null;
			private AggregateParameter _Status_W = null;
			private AggregateParameter _Priority_W = null;
			private AggregateParameter _TourID_W = null;

			public void AggregateClauseReset()
			{
				_VideoID_W = null;
				_VideoTitle1_W = null;
				_VideoTitle2_W = null;
				_VideoTitle3_W = null;
				_URL_W = null;
				_InitContent1_W = null;
				_InitContent2_W = null;
				_InitContent3_W = null;
				_CreatedDate_W = null;
				_Status_W = null;
				_Priority_W = null;
				_TourID_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private EasyObject _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	}
}
